<template>
        <div class="father">
                <h2>父组件</h2>
                <h3>儿子玩具：{{ toy }}</h3>
                <!-- 在父组件中，给子组件绑定自定义事件 -->
                <Child @send-toy="saveToy"></Child>
        </div>
</template>
<script lang="ts" setup>
import Child from './Child.vue';
import {ref} from 'vue'

let toy = ref("")

function saveToy(value:string){
       toy.value = value
}
</script>
<style scoped>
.father {
        background: gray;
        padding: 10px;
        box-shadow: 0 0 10px black;
        border-radius: 10px;
        margin: 0 10px;
}
</style>